package org.jeecg.modules.demo.mall.api;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.mall.api.fallback.MallHelloFallback;
import org.jeecg.modules.demo.mall.dto.ProductNumDto;
import org.jeecg.modules.demo.mall.entity.*;
import org.jeecg.modules.demo.weixin.dto.PayDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "jeecg-mall", fallbackFactory = MallHelloFallback.class)
public interface MallHelloApi {

    /**
     * mall hello 微服务接口
     *
     * @param
     * @return
     */
    @GetMapping(value = "/mall/hello")
    String callHello();

    //保存商户店员
    @PostMapping("/mall/yxsystemstorestaff/yxSystemStoreStaff/saveMerchantUser")
    boolean saveMerchantUser(@RequestBody YxSystemStoreStaff yxSystemStoreStaff);

    //根据门店和用户查询详情
    @GetMapping(value = "/mall/yxuser/yxUser/queryUser")
    YxUser queryUser(@RequestParam Integer id);


    @GetMapping(value = "/mall/yxsystemuserlevel/yxSystemUserLevel/queryLevel")
    YxSystemUserLevel queryLevel(@RequestParam(name = "id", required = true) Integer id);


    @PostMapping(value = "/mall/yxuserrecharge/yxUserRecharge/add")
    Result<String> add(@RequestBody YxUserRecharge yxUserRecharge);

    //更新用户余额和积分
    @PostMapping(value = "/mall/yxuser/yxUser/updateAmount")
    void updateAmount(@RequestBody YxUser yxUser);

    //用户使用余额支付时扣掉余额
    @PostMapping(value = "/mall/yxuser/yxUser/subBalance")
    Result<?> subBalance(@RequestBody YxUser yxUser);

    @GetMapping(value = "/mall/yxstoreproduct/yxStoreProduct/queryTitle")
    YxStoreProduct queryTitle(@RequestParam(name = "title", required = true) String title);

    @PostMapping(value = "/mall/yxuser/yxUser/updateMerchant")
    YxStoreProduct updateMerchant(@RequestBody YxUser yxUser);

    //根据门店查询所有的员工
    @GetMapping(value = "/mall/yxuser/yxUser/queryUserList")
    List<YxUser> queryUserList(@RequestParam(name = "merId", required = true) String merId);


    //订单优惠券修改接口
    @GetMapping(value = "/mall/cashierCouponUser/cashiercouponuser/editCouponUser")
    void editCouponUser(@RequestParam Integer couponId, @RequestParam String orderNo);

    //添加积分
    @PostMapping(value = "/mall/yxuser/yxUser/addIntegral")
    void addIntegral(@RequestBody YxUser yxUser);

    //删除积分
    @PostMapping(value = "/mall/yxuser/yxUser/subIntegral")
    void subIntegral(@RequestBody YxUser yxUser);

    //订单下单是进行修改
    @PostMapping(value = "/mall/yxuser/yxUser/saveUserLevelValue")
    Boolean saveUserLevelValue(@RequestBody PayDto payDto);


    @RequestMapping(value = "/mall/yxgrowthvalue/yxGrowthValue/growthValueCalculation", method = RequestMethod.POST)
    Boolean growthValueCalculation(@RequestBody PayDto payDto);

    //成长值是扣除
    @GetMapping(value = "/mall/yxuserlevel/yxUserLevel/subgrowthValues")
    void subgrowthValues(@RequestParam Integer uid, @RequestParam String orderId);

    /**
     * 订单库存修改
     */
    @PostMapping(value = "/mall/yxstoreproduct/yxStoreProduct/updateNum")
    void updateNum(@RequestBody ProductNumDto productNumDto);

    @PostMapping(value = "/mall/yxstoreproduct/yxStoreProduct/checkNum")
     Boolean checkNum(@RequestBody ProductNumDto productNumDto);

    @GetMapping(value = "/mall/yxstorecouponuser/yxStoreCouponUser/queryByOrderNo")
    YxStoreCouponUser queryByOrderNo(@RequestParam String id);


    //平台商品查看名称
    @GetMapping(value = "/mall/yxstoreproduct/yxStoreProduct/queryName")
    YxStoreProduct queryName(@RequestParam Integer storeId);
}
